<!--
 * @Author: 杨超
 * @Date: 2021-11-24 20:33:45
 * @LastEditTime: 2021-12-01 17:33:30
 * @LastEditors: 杨超
 * @Description:
-->
<template>
  <!-- 普通输入框 -->
  <div
    :style="item.style || {}"
    :class="`form-unqiue-${item.key}`"
  >
    <el-input
      v-if="!getTextModel"
      v-model="val"
      :placeholder="getPlaceholder(item)"
      :disabled="getDisabled"
      type="textarea"
      :autosize="item.autosize || false"
      :rows="item.rows || 4"
      :resize="item.resize || 'none'"
      v-bind="item"
      @blur="(e) => onBlur(item, e)"
      @focus="(e) => onFocus(item, e)"
    />
    <div v-else :style="item.textStyle || {}" class="form-input-text">
      {{ val || '-' }}
    </div>
  </div>
</template>

<script>
import FormMixin from './mixin'

export default {
    name: 'FormInput',
    mixins: [FormMixin],
    data() {
        return {}
    },
    computed: {
    // 前置符号
        prepend() {
            // 兼容性处理
            if (this.item.prepend) {
                return this.item.prepend
            } else if (this.item.prependMsg) {
                return this.item.prependMsg
            } else {
                return ''
            }
        },
        // 后置符号
        append() {
            // 兼容性处理
            if (this.item.append) {
                return this.item.append
            } else if (this.item.appendMsg) {
                return this.item.appendMsg
            } else {
                return ''
            }
        }
    }
}
</script>

<style scoped lang="scss">
</style>
